package day_2022_4_to_7.day48;

import java.util.Scanner;

/**
 * 完全数计算
 * @author haomin
 * @date 2022/05/12 20:52
 **/
public class Day16_1_FindPerfectNum {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();

        int count = 0;
        for(int i = 2;i < 1000; i++){
            if(findPerfectNum(i)){
                count ++;
            }
        }
        System.out.println(count);
    }
    private static boolean findPerfectNum(int num){
        int sum = 1;
        for(int i = 2;i < Math.sqrt(num);i++) {
            if (num % i == 0) {
                sum += i;
                if ((num / i) != i) {
                    sum += (num / i);
                }
            }
        }
        return sum == num ? true : false;
    }
}